package com.cetc39.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.cetc39.bean.Client;
import com.cetc39.dao.ClientDao;

public class ClientDaoImpl extends HibernateDaoSupport implements ClientDao {

	@Override
	public void save(Client c) {
		this.getHibernateTemplate().save(c);
	}

	@Override
	public void update(Client c) {
		this.getHibernateTemplate().saveOrUpdate(c);
	}

	@Override
	public List<?> findAll() {
		List<?> cList = this.getHibernateTemplate().find("FROM Client");
		return cList;
	}

	@Override
	public Client findById(int id) {
		Client c = this.getHibernateTemplate().get(Client.class, id);
		return c;
	}

	@Override
	public void delete(int id) {
		Client c = this.getHibernateTemplate().get(Client.class, id);
		this.getHibernateTemplate().delete(c);
	}

}
